<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
	<title>Promise核心</title>
	<style type="text/css">
	body {
		padding: 30px;
	}

</style>
</head>
<body>
	<div id="hd"></div>
	<div id="hd2"></div>
	<script src="index.js"></script>
	<script type="text/javascript">


		var pro = new Promise((resolve, reject) => {
			setTimeout(() => {
			    resolve("后盾人");
			    console.log('大叔视频')
			    
			}, 333);
		})

		var proThen = pro.then(
			value => {
				console.log(value);
				// return proThen
			},
			reason => {
				console.log(reason);
			}
		);


		var p = new HD((resolve, reject) => {
			setTimeout(() => {
			    resolve("后盾人");
			    console.log('大叔视频')
			    
			}, 333);
		})

		var pThen = p.then(
			value => {
				console.log(value);
				return 'sdfsdf'
			},
			reason => {
				console.log(reason);
			}
		);

		console.log(pThen)
		
		console.log("houdunren.com");


		function f0(){ 
			var p1 = new HD((resolve, reject) => {
				console.log(typeof resolve, typeof reject)
				resolve('success')

			})

			p1.then(value => {
				console.log('value => ', value)
				throw 'then error'
			}, reason => {
				console.warn('reason => ', reason)
			})

		}
		function f1() {
			console.log(p1)
			console.log(p1.resolve)
			console.log('-----------------------\n')



		}
	</script>
</body>
</html>